package com.example.finance_oa.dubbo;

import com.example.comment_oa.pojos.Amount;
import com.example.comment_oa.pojos.Budget;
import com.example.comment_oa.pojos.Standard;
import com.example.finance_oa.mapper.*;
import com.example.finance_oa.service.AmountService;
import lombok.Data;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.ibatis.annotations.Param;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@DubboService(version = "1.0.0",protocol = "${dubbo.protocol.id}",
        application = "${dubbo.application.id}",registry = "${dubbo.registry.id}",
        timeout = 3000)
public class AmountDubbo implements com.example.comment_oa.dubbo.AmountDubbo {
@Resource
StandardMapper standardMapper;
@Resource
BudgetMapper budgetMapper;
@Resource
    AmountMapper amountMapper;
@Resource
    AmountXbMapper amountXbMapper;
@Resource
    InvoiceMapper invoiceMapper;
    @Override
    public List<Standard> selectStandard(String budgetKm) {
        return standardMapper.standardBykm(budgetKm);
    }

    @Override
    public List<Budget> selectByyscs(String year, String month, String deptName, String budgetKm) {
        return budgetMapper.selectBycs(year,month,deptName,budgetKm);
    }



    @Override
    public int insertBXzb(String amountProcess, String amountTitle, Date amountTime, String deptName, Integer empId, Integer amountState, Double amountMoney,String empCard,String empName) {
        return amountMapper.insertAll(amountProcess,amountTitle,amountTime,deptName,empId,amountState,amountMoney,empCard,empName);
    }

    @Override
    public int insertBxxb(String bxkm, Double bxje, String invoicePhone, String amountProcess, String deptName, Date cdqj) {
        return amountXbMapper.insertAmountXb(bxkm,bxje,invoicePhone,amountProcess,deptName,cdqj);
    }
    //查询差旅报销标准
    @Override
    public int updateinvoicePhone(String invoicePhone){
        return invoiceMapper.updateInvoicePhone(invoicePhone);
    }

    @Override
    public int updateCsys(Double budgetCsmoney, String budgetYear, String budgetMonth,String deptName, String budgetKm){
        return budgetMapper.updateCsys(budgetCsmoney,budgetYear,budgetMonth,deptName,budgetKm);
    }


    //根据发票号码把状态改为已报销
    @Override
    public int updatestate(String invoicePhone){
        return invoiceMapper.updateInvoicePhone2(invoicePhone);
    }

    @Override
    public int updatebxstate(Integer amountState, String amountProcess) {
        return amountMapper.updateAmountState(amountState,amountProcess);
    }

    @Override
    public int updateSy(Double budgeSymoney, String budgetYear, String budgetMonth, String deptName, String budgetKm) {
        return budgetMapper.updateSyys(budgeSymoney,budgetYear,budgetMonth,deptName,budgetKm);
    }

    @Override
    public int updateCs(Double budgetCsmoney, String budgetYear, String budgetMonth, String deptName, String budgetKm) {
        return budgetMapper.updateCsys2(budgetCsmoney,budgetYear,budgetMonth,deptName,budgetKm);
    }

    @Override
    public List<Amount> spju(String amountProcess) {
        return amountMapper.amountXb(amountProcess);
    }


}
